//
//  SummitOrderViewController.m
//  jingjing2.0
//
//  Created by apple on 16/5/9.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "SubmitOrderViewController.h"
#import "AddNewAddressViewController.h"
#import "MyAddressViewController.h"
#import "MyCouponViewController.h"
#import "AddressData.h"
#import "NSDate+Utils.h"
#import "NSDate+Helper.h"
@interface SubmitOrderViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    NSInteger _pageIndex;//页数
    NSDictionary *_addressDic;
    NSDictionary *_couponDic;
    UILabel *_pricelbl;
    UILabel *_needPayPrice;
    CGFloat _couponMoney;
    NSString *_addressID;
    NSArray *_dateArr;
    NSArray *_typeArr;
    NSMutableArray *_bigArr;
}
@property(nonatomic,strong)UITableView *tableView;
@end

@implementation SubmitOrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _pageIndex=1;
    self.title=@"订单提交";
    _addressDic=[NSDictionary dictionary];
    _couponDic=[NSDictionary dictionary];
    _typeArr=[NSArray array];
    _dateArr=[NSArray array];
    _bigArr=[NSMutableArray array];
     [self getCoupon];
    [self.view addSubview:self.tableView];
    [self setUpButtomView];
    [self getDefaultAddress];
   
}
#pragma mark--底部视图
-(void)setUpButtomView
{
    UIView *bottomView=[[UIView alloc]initWithFrame:CGRectMake(0, kHeight-100, kWidth, 100)];
    bottomView.layer.borderColor=GRAYCOLOR.CGColor;
    bottomView.layer.borderWidth=1.0;
    bottomView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:bottomView];
    
    //订单金额
    _pricelbl=[[UILabel alloc]initWithFrame:CGRectMake(10, 0, 200, 50)];
    _pricelbl.textAlignment=NSTextAlignmentLeft;
    _pricelbl.font=[UIFont systemFontOfSize:13];
    _pricelbl.text=[NSString stringWithFormat:@"订单金额 ¥%.2f",_price];
    [bottomView addSubview:_pricelbl];
    
    //待支付
    _needPayPrice=[[UILabel alloc]initWithFrame:CGRectMake(kWidth-130, 0, 120, 50)];
    _needPayPrice.font=[UIFont systemFontOfSize:13];
    _needPayPrice.text=[NSString stringWithFormat:@"订单金额 ¥%f",_price];
    NSString *sumPrice=[NSString stringWithFormat:@"待支付：¥%.2f",_price];
    NSInteger length=[NSString stringWithFormat:@"%.2f",_price].length;
    NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:sumPrice];
    //把价格的字体颜色变为红色
    [attriString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(4, length+1)];
    [attriString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:17] range:NSMakeRange(4, length+1)];
    [_needPayPrice setAttributedText:attriString];

    [bottomView addSubview:_needPayPrice];
    
    //提交订单
    UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 50, kWidth, 50)];
    btn.backgroundColor=BLUECOLOR;
    [btn setTitle:@"提交订单" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(submitOrder) forControlEvents:UIControlEventTouchUpInside];
    [bottomView addSubview:btn];

}
-(void)submitOrder
{
    //http://192.168.1.107:3722/Order/SubmitOrder
    //m_OrderCreate(UserCode,MOrderID,AddressId,CollDate,CollTimeGroupID,CollTimeGroup,ClientType,OrderCategoryID,m_OrderProCat(ProOrderCategoryCode,ItemCount),StorageMonth,UserRemark,CouponCode,FactoryCode,FactoryCouponCode,CollType,Timestamp,Sign)
    NSLog(@"YES");
}
#pragma mark--表
-(UITableView *)tableView
{
    if (!_tableView) {
        _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, kWidth, kHeight-80) style:UITableViewStylePlain];
        _tableView.delegate=self;
        _tableView.dataSource=self;
    }
    return _tableView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if (section==4) {
        return 10;
    }
    return 0;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 5;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section==1) {
        return 2;
    }else if (section==3)
    {
        if (self.dataSource>0) {
            return self.dataSource.count+1;
        }else
        {
            return 1;
        }
    }
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        return 60;
    }
    return 50;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"reuse"];
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 160, 50)];
    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 150, 50)];
    label.textColor=BLUECOLOR;
    label.textAlignment=NSTextAlignmentRight;
    label.font=[UIFont systemFontOfSize:13];
    
    UIImageView *image=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"right_gray_action"]];
    image.frame=CGRectMake(155, 19, 15, 15);
    [view addSubview:image];
    [view addSubview:label];
    
    if (!cell) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"reuse"];
        cell.textLabel.textColor=[UIColor darkGrayColor];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
        if (indexPath.section==0) {
            cell.contentView.backgroundColor=[UIColor colorWithRed:250/255.0 green:240/255.0 blue:226/255.0 alpha:0.5];
            UIImageView *image=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sumbit_address_line"]];
            image.frame=CGRectMake(0, 0, kWidth, 4);
            [cell.contentView addSubview:image];
            
            UIImageView *image1=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"right_gray_action"]];
            image1.frame=CGRectMake(kWidth-20, 20, 15,15);
            [cell.contentView addSubview:image1];

        }else if (indexPath.section==1)
        {
            NSArray *arr=@[@"取衣方式",@"取衣时间"];
            NSArray *accessArr=@[@"上门取件",@"请选择"];
            label.text=accessArr[indexPath.row];
            cell.textLabel.text=arr[indexPath.row];
            cell.accessoryView=view;
        }else if (indexPath.section==2)
        {
            cell.textLabel.text=@"净净优惠券";
            cell.accessoryView=view;

        }else if (indexPath.section==3)
        {
            //数量
            if (self.dataSource.count>0) {
                UILabel *number=[[UILabel alloc]initWithFrame:CGRectMake(kWidth/2.0, 0, 50, cell.frame.size.height)];
                [cell.contentView addSubview:number];
                //价格
                UILabel *price=[[UILabel alloc]initWithFrame:CGRectMake(kWidth-90, 0, 70, cell.frame.size.height)];
                [cell.contentView addSubview:price];
                
                
                if (indexPath.row==0) {
                    cell.textLabel.text=@"订单详情";
                    cell.textLabel.font=[UIFont systemFontOfSize:17];
                }else
                {
                    CustomButton *button=self.dataSource[indexPath.row-1];
                    cell.textLabel.text=button.title;
                    cell.textLabel.font=[UIFont systemFontOfSize:15];
                    number.text=[NSString stringWithFormat:@"x%@",button.label.text];
                    price.text=[NSString stringWithFormat:@"¥%.2f",button.btn.price*[button.label.text intValue]];
                }

            }else
            {
                cell.textLabel.text=@"订单详情";
            }
            
        }else
        {
            cell.textLabel.text=@"备注:";
            UITextField *tx=[[UITextField alloc]initWithFrame:CGRectMake(cell.textLabel.frame.origin.x+70, 5, kWidth-50, cell.frame.size.height)];
            tx.placeholder=@"选填，如有特殊要求请填写...";
            [cell.contentView addSubview:tx];
        }
        
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell=[_tableView cellForRowAtIndexPath:indexPath];
    if (indexPath.section==0) {
        if ([cell.detailTextLabel.text isEqualToString:@"添加一个新的地址"]) {
            [self addANewAddress];
        }else
        {
            [self chooseANewAddress];
        }
    }else if (indexPath.section==1)
    {
      
      if (indexPath.row==0) {
         CustomPickView *pickView=[[CustomPickView alloc]initWithIsTime:NO];
          pickView.dataArray=_typeArr;
          UIView *superView=cell.accessoryView;
          UILabel *label=nil;
          for (UIView *view in superView.subviews)
          {
              if ([view isKindOfClass:[UILabel class]])
              {
                  label=(UILabel *)view;
                  pickView.label=label;
              }
          }
          [pickView show];
        }else
        {
            UITableViewCell *addressCell=[_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
            if ([addressCell.detailTextLabel.text isEqualToString:@"添加一个新的地址"]) {
                [ZMTool showAlertWithDifferentVersioninWhichViewController:self withTitle:nil andMessage:@"请先选择地址" andSureTitle:@"知道了" andCancleTitle:nil isDelegate:nil andSureBlock:nil andCancleBlock:nil];
                return;
            }
            for (NSDictionary *dic in _dateArr) {
                [self getTimeDataWithCollDate:dic[@"CollDate"]];
            }

           CustomPickView *pickView=[[CustomPickView alloc]initWithIsTime:YES];
            //赋值数据源
            pickView.dataArray=_dateArr;//几月几号
            pickView.dateArray=_bigArr;//时间段
            //弹出pickView
            UIView *superView=cell.accessoryView;
            UILabel *label=nil;
            for (UIView *view in superView.subviews)
            {
                if ([view isKindOfClass:[UILabel class]])
                {
                    label=(UILabel *)view;
                    pickView.label=label;
                }
            }
            [pickView show];

        }
        
        
    }else if (indexPath.section==2)
    {
        NSArray *arr=cell.accessoryView.subviews;
        for (UIView *view in arr) {
            if ([view isKindOfClass:[UILabel class]])
            {
                UILabel *label=(UILabel *)view;
               if ([label.text isEqualToString:@"没有可用优惠券"])
               {
                  return;
               }else
               {
                    MyCouponViewController *myCoupon=[[MyCouponViewController alloc]init];
                    myCoupon.isUse=YES;
                   myCoupon.passCouponBlock=^(MyCouponModel *model)
                   {
                       label.text=model.CouponName;
                       //优惠后的金额
                       _couponMoney=_price-[model.ShowMoney floatValue];
                       //改变订单金额
                      NSString *orderMoney=[NSString stringWithFormat:@"订单金额 ¥%.2f -优惠 ¥%.2f",_price,[model.ShowMoney floatValue]];
                       NSInteger length1=[NSString stringWithFormat:@"-优惠 ¥%.2f",[model.ShowMoney floatValue]].length;
                        NSInteger length=[NSString stringWithFormat:@"订单金额 ¥%.2f",_price].length;
                       NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:orderMoney];
                       //把价格的字体颜色变为绿色
                       [attriString addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(length, length1+1)];
                       [attriString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13] range:NSMakeRange(4, length+1)];
                       _pricelbl.attributedText=attriString;
                       
                       //改变待支付金额
                       NSString *sumPrice=[NSString stringWithFormat:@"待支付：¥%.2f",_couponMoney];
                       NSInteger length3=[NSString stringWithFormat:@"%.2f",_couponMoney].length;
                       NSMutableAttributedString *attriString1 = [[NSMutableAttributedString alloc] initWithString:sumPrice];
                       //把价格的字体颜色变为红色
                       [attriString1 addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(4, length3+1)];
                       [attriString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:17] range:NSMakeRange(4, length3+1)];
                       [_needPayPrice setAttributedText:attriString1];
                   };
                    [self.navigationController pushViewController:myCoupon animated:YES];
                }
            
            }
        }
    }

}
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"%ld",(long)indexPath.row);
}
//添加新的地址
-(void)addANewAddress
{
    AddNewAddressViewController *addAddress=[[AddNewAddressViewController alloc]init];
    addAddress.title=@"地址新增";
    addAddress.categoryID=_categoryID;
    addAddress.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:addAddress animated:YES];
}
//管理我的地址
-(void)chooseANewAddress
{
    MyAddressViewController *myAddress=[[MyAddressViewController alloc]init];
    myAddress.isAddressManager=NO;
    myAddress.categoryID=self.categoryID;
    myAddress.hidesBottomBarWhenPushed=YES;
    __block UITableViewCell *cell=[_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
    myAddress.passDataBlock=^(AddressData *data)
    {
        [MBProgressHUD showSuccess:@"地址添加成功，请选择取衣方式！"];
        _addressID=data.AddressId;
        [self getOrderData];
        NSString *sex=nil;
        if ([data.Sex intValue]==1) {
            sex=@"先生";
        }else
        {
            sex=@"女士";
        }
        cell.textLabel.text=@"";
        cell.detailTextLabel.text=@"";
        cell.textLabel.text=[NSString stringWithFormat:@"%@ %@ %@",[data.ReceiveName stringByRemovingPercentEncoding],sex,data.Mobile];
        cell.detailTextLabel.backgroundColor=[UIColor clearColor];
        cell.detailTextLabel.font=[UIFont systemFontOfSize:12];
        cell.detailTextLabel.textColor=[UIColor blackColor];
        cell.detailTextLabel.text=[NSString stringWithFormat:@"%@%@%@%@",[data.CityName stringByRemovingPercentEncoding],[data.AreaName stringByRemovingPercentEncoding],[data.LocateAddress stringByRemovingPercentEncoding],
                                   [data.DetailAddress stringByRemovingPercentEncoding]];
       
    };
     myAddress.currentAddress=cell.detailTextLabel.text;
    [self.navigationController pushViewController:myAddress animated:YES];
}
#pragma mark--进来和出去的一些设置
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [GeneralTool hideTabBar];
    //刷新数据
    
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [GeneralTool showTabBar];
}
-(void)getDefaultAddress
{
    //获取默认地址
    [GeneralTool getMyAddressListWithIsDefault:@"DEFAULT" andReuqestBlock:^(id response, NSError *error) {
        if (error) {
            [MBProgressHUD showError:@"请求错误，请检查网络"];
        }else
        {
            if ([response[@"IsSuccess"]intValue]==1) {
                NSArray *Arr=response[@"ReturnObject"];
                UITableViewCell *cell=[_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
                if(Arr.count==0) {
                    cell.detailTextLabel.backgroundColor=[UIColor clearColor];
                    cell.detailTextLabel.font=[UIFont systemFontOfSize:20];
                    cell.detailTextLabel.text=@"添加一个新的地址";
                    cell.detailTextLabel.textColor=BLUECOLOR;
                }else
                {
                    
                    for (NSDictionary *dic in Arr) {
                        NSString *sex=nil;
                        if ([dic[@"sex"]intValue]==1) {
                            sex=@"先生";
                        }else
                        {
                            sex=@"女士";
                        }
                        cell.textLabel.text=[NSString stringWithFormat:@"%@ %@ %@",[dic[@"ReceiveName"]stringByRemovingPercentEncoding],sex,dic[@"Mobile"]];
                        cell.detailTextLabel.backgroundColor=[UIColor clearColor];
                        cell.detailTextLabel.text=[NSString stringWithFormat:@"%@%@%@%@",[dic[@"CityName"]stringByRemovingPercentEncoding],[dic[@"AreaName"]stringByRemovingPercentEncoding],[dic[@"LocateAddress"]stringByRemovingPercentEncoding],
                                                   [dic[@"DetailAddress"]stringByRemovingPercentEncoding]];
                        cell.detailTextLabel.numberOfLines=0;
                        _addressID=dic[@"AddressId"];
                        [self getOrderData];
                    }
                }
                
            }
        }
    }];
 
}
-(void)getCoupon
{
    //查看优惠券
    [GeneralTool getMyCouponWithIsCanUse:@"1" andPageIndex:1 andReuqestBlock:^(id response, NSError *error) {
        UITableViewCell *cell=[_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:2]];
        NSArray *arr=cell.accessoryView.subviews;
        for (UIView *view in arr) {
            if ([view isKindOfClass:[UILabel class]]) {
                UILabel *label=(UILabel *)view;
                NSArray *dataArr=response[@"ReturnObject"];
                if (dataArr.count>0) {
                    label.text=[NSString stringWithFormat:@"目前有%ld张可用",(unsigned long)dataArr.count];
                    label.textColor=BLUECOLOR;
                }else
                {
                    label.text=@"没有可用优惠券";
                    label.textColor=[UIColor lightGrayColor];

                }
                
            }
        }
    }];
 
}
-(void)getTimeDataWithCollDate:(NSString *)collDate
{
    //http://192.168.1.107:3722/Common/CollTimeSpan/{CollDate}/{CityCode}/{Timestamp}/{Sign}
    NSDictionary *dic=@{@"CollDate":collDate,
                        @"CityCode":GETCITYCODE,
                        @"Timestamp":[GeneralTool gettimestamp]};
    NSString *sign=[GeneralTool GetSin:dic];
    NSString *urlSTring=[NSString stringWithFormat:@"Common/CollTimeSpan/%@/%@/%@/%@",collDate,GETCITYCODE,[GeneralTool gettimestamp],sign];
    [RequestTool requestDataWithType:@"get" andUrlString:urlSTring andParameters:nil andRequestFinished:^(id responses, NSError *error) {
        NSLog(@"111");
        if (error) {
            [MBProgressHUD showError:@"加载信息失败，请稍后再试～"];
        }
        if ([responses[@"IsSuccess"]integerValue]==1) {
            [_bigArr addObject:responses[@"ReturnObject"]];
        }
    }];
    
}

#pragma mark--获取订单数据
-(void)getOrderData
{
    //MOrderID --包月洗orderID
    
    //http://192.168.1.107:3722/Order/SubmitOrderPageInfo/{UserCode}/{MOrderID}/{CityCode}/{ClientType}/{OrderCategoryID}/{AddressId}/{Timestamp}/{Sign}
    NSDictionary *dic=@{@"UserCode":GETUSERCODE,
                        @"CityCode":GETCITYCODE,
                        @"MOrderID":@"-1",
                        @"ClientType":CLIENTTYPE,
                        @"OrderCategoryID":_categoryID,
                        @"AddressId":_addressID,
                        @"Timestamp":[GeneralTool gettimestamp]};
    NSString *sign=[GeneralTool GetSin:dic];
    NSString *urlSTring=[NSString stringWithFormat:@"Order/SubmitOrderPageInfo/%@/%@/%@/%@/%@/%@/%@/%@",GETUSERCODE,@"-1",GETCITYCODE,CLIENTTYPE,_categoryID,_addressID,[GeneralTool gettimestamp],sign];
    [RequestTool requestDataWithType:@"get" andUrlString:urlSTring andParameters:nil andRequestFinished:^(id responses, NSError *error) {
        if (error) {
            [MBProgressHUD showError:@"加载信息失败，请稍后再试～"];
        }
        if ([responses[@"IsSuccess"]integerValue]==1) {
            NSDictionary *dic=responses[@"ReturnObject"];
            _dateArr=dic[@"CollDateList"];
            _typeArr=dic[@"CollTypeList"];
        }
    }];
    
}
#pragma mark-------------获取时间数据源的方法
//            NSArray * dataSourceToday = [self getTheDataSourceToday];
//            NSArray * dataSourceTomorrow = [self dateBegin:10 andEnd:20];
//            NSArray * dataSourceAfterNoon = [self dateBegin:10 andEnd:20];
//           NSArray * bigArray;
//            //时间段
//            NSArray * dateArray = nil;//日期－天
//            if (!dataSourceToday||dataSourceToday.count<=0)
//            {
//                bigArray = @[dataSourceTomorrow,dataSourceAfterNoon];
//                dateArray = [self getThedatesArrayIsContaintToday:NO];
//            }else
//            {
//                bigArray = @[dataSourceToday,dataSourceTomorrow,dataSourceAfterNoon];
//                dateArray = [self getThedatesArrayIsContaintToday:YES];
//            }
//


//-(NSArray *)dateBegin:(NSInteger)begin andEnd:(NSInteger)end
//{
//    NSInteger count = (end - begin)/2;
//    NSMutableArray * arr = [NSMutableArray arrayWithCapacity:count];
//    for (int i= 0; i<count; i++)
//    {
//        [arr addObject:[NSString stringWithFormat:@"%zd:00-%zd:00",begin,begin+2]];
//        begin = begin + 2;
//    }
//    return arr;
//}
//获取1区时间段的数据源
//-(NSArray *)getTheDataSourceToday
//{
//    NSArray * dataSource = nil;
//    NSInteger hour = [[NSDate date]hour];
//    
//    // 计算今天的数据源
//    if (hour <= 10)
//    {
//        dataSource = [self dateBegin:10 andEnd:20];
//    }else if (hour>10&&hour<=12)
//    {
//        dataSource = [self dateBegin:12 andEnd:20];
//    }else if (hour>12&&hour<=14)
//    {
//        dataSource = [self dateBegin:14 andEnd:20];
//    }else if (hour>14&&hour<=16)
//    {
//        dataSource = [self dateBegin:16 andEnd:20];
//    }else if (hour>16&&hour<=18)
//    {
//        dataSource = [self dateBegin:18 andEnd:20];
//    }else
//    {
//        //不显示今天
//    }
//    return dataSource;
//}
//
////获取0区日期的数据源
//-(NSArray *)getThedatesArrayIsContaintToday:(BOOL)isContaint
//{
//    NSMutableArray * dataSource = [NSMutableArray arrayWithCapacity:3];
//    for (int i = 0; i<3; i++)
//    {
//        
//        NSInteger month = [[NSDate dateWithTimeIntervalSinceNow:i*3600*24]month];
//        NSInteger today = [[NSDate dateWithTimeIntervalSinceNow:i*3600*24]day];
//        if (!isContaint&&i==0)
//        {
//            
//        }else
//        {
//        [dataSource addObject:[NSString stringWithFormat:@"%zd月%zd日",month,today]];
//        }
//    }
//    return dataSource;
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   // sumbit_address_line
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
